package com.supergdtop.www.run.tools;

import android.os.Handler;

/**
 * 延时工具
 * 
 * @author Asum
 *
 */
public class DelayTools {
	private static Handler handler;

	public static void delay(final DelayToolsCallBack callBack, final int delay) {
		handler = new Handler();
		new Thread(new Runnable() {
			public void run() {
				try {
					Thread.sleep(delay);
					handler.post(new Runnable() {
						public void run() {
							if (callBack != null) {
								callBack.toDo();
							}
						}
					});
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}).start();
	}

	public interface DelayToolsCallBack {
		public void toDo();
	}
}
